﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Guoc.Log
{
   public class FileLog :ILog
    {
       //private FileLog() { }

       //public static readonly FileLog Instance = new FileLog();

       
        public void WriteLog(string message,string outPath)
        {
            FileStream fs = null;
            
            try
            {
                fs = new FileStream(outPath, FileMode.OpenOrCreate);
                long current = fs.Length;
                fs.Seek(current, SeekOrigin.Current);
                StreamWriter writer = new StreamWriter(fs, Encoding.Default);
                string line = DateTime.Now.ToString() + ":";
                line += message;
                writer.WriteLine(line);
                writer.Flush();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally {
               
                fs.Close();
            }
        }
    }
}
